<?php
ini_set('display_errors', 1);
$dir = dirname(dirname(__FILE__));
include_once 'Common.inc.php';

include($dir.'/__queue_global.php');

$host = 'm6210i.apollo.grid.sina.com.cn';
$port = '6210';
$user = 'elink';
$pw = 'elink2046';
$name = 'elink';
$table = 'ml_3rd_service';

$sql = "SELECT `uid`, `service_id`, `access_token`, `3rd_id` FROM `ml_3rd_service`";

$conn = mysql_connect($host.':'.$port , $user , $pw, true);
mysql_set_charset('utf-8' , $conn);
$re = mysql_select_db($name , $conn);

if (!$re) {
    echo 'fail'.$table."\r\n";
echo mysql_errno() . ": " . mysql_error() . "\n";
    exit('connect fail');
}
$rs = mysql_query($sql , $conn);
if (!$rs) {
    echo 'fail'.$table."\r\n";

echo mysql_errno() . ": " . mysql_error() . "\n";
    exit('connect query');
}

$oBizAt = new ml_biz_extRelation_extFollow();
$row = 1;
$i=1;
while (!empty($row)){
    $i++;
    if ($i>10) break;
$row = mysql_fetch_array($rs , MYSQL_ASSOC);

$re = $oBizAt->init_newExtFollow_redis($row['uid'], $row['3rd_id'], $row['service_id'], $row);
//$re = ml_tool_sendMq::add_atnick_nick($row['nickname'], $row['uid']);
if (!$re) {
    $error[]= $row['uid'];
}
};

$str = json_encode($error);
file_put_contents('error.log', $str);
